<?php
	session_start();

	require_once('../../lib/'.'BaseDir.inc.htm');	
	require_once (EIU_CLASS.'Category.htm');
	
	$category_class = new category();
	if(isset($_POST["sort"]))	$orderBy = $_POST["sort"];
	else $orderBy = "CATCode";
	
	$rs = $category_class->getCategoriesListOrderBy($orderBy);
	
	
	$i = 0;
	if(is_array($rs)){
		foreach($rs as $key=>$value){
			$data1['CATID'] = $rs[$key]->CATID;
			$data1['CATCode'] = $rs[$key]->CATCode;
			$data1['CATName'] = $rs[$key]->CATName;
			$data1['hasBarQRCode'] = $rs[$key]->hasBarQRCode;
			$arr["Result"][$i] = $data1;
			$i++;
		}
		echo json_encode($arr);
	}else{
		echo 'NG';
	}
	

?>
